package com.wy.base;

import java.io.Serializable;

import javax.persistence.Transient;

import com.alibaba.fastjson.annotation.JSONField;

import lombok.Getter;
import lombok.Setter;

/**
 * @description 所有实体类和分页参数类都可继承该类
 * @author ParadiseWY
 * @date 2019年2月15日 下午1:58:47
 * @git {@link https://github.com/mygodness100}
 */
@Getter
@Setter
public abstract class AbstractPager implements Serializable {

	private static final long serialVersionUID = 1L;

	@Transient
	@JSONField(serialize = false)
	private Integer pageIndex;

	@Transient
	@JSONField(serialize = false)
	private Integer pageSize;

	public boolean hasPager() {
		if (pageIndex == null || pageIndex <= 0) {
			return false;
		}
		if (pageSize == null || pageSize <= 0) {
			pageSize = 10;
		}
		return true;
	}
}